package com.punai.framework.config;

import com.punai.common.utils.SecurityUtils;
import org.springframework.security.crypto.password.MessageDigestPasswordEncoder;
import org.springframework.stereotype.Component;


@Component
public class MD5PasswordEncoder extends MessageDigestPasswordEncoder  {

    public MD5PasswordEncoder() {
        super("MD5");
    }

    public String encodePassword(String rawPass) {
        return SecurityUtils.md5EncodePassword(rawPass);
    }

    @Override
    public boolean matches(CharSequence rawPassword, String encodedPassword) {
        return SecurityUtils.matchesMD5Password(rawPassword,encodedPassword);
    }



}
